<template>
  <div>
    <el-card class="box-card">
      <!-- 领导人列表区 -->
      <el-table border stripe :data="tiemlineList" ref="multipleTable"
        :default-sort="{ prop: 'date', order: 'descending' }" style="width: 100%">
        <el-table-column type="index" sortable align="center" label="#" width="50">
        </el-table-column>
        <el-table-column align="center" prop="title" label="标题">
        </el-table-column>
        <el-table-column align="center" prop="time" label="时间">
          <template slot-scope="scope">
            <div>
              {{ formatDate(scope.row.time) }}
            </div>
          </template>
        </el-table-column>

        <el-table-column align="center" prop="mainStory" label="简介">
        </el-table-column>
        <el-table-column align="center" label="插图(查看大图)">
          <template #default="scope">
            <el-image class="table-td-headPortrait" :src="scope.row.imgSrc" :preview-src-list="[scope.row.imgSrc]">
            </el-image>
          </template>
        </el-table-column>
        <el-table-column align="center" show-overflow-tooltip prop="desc" label="主要事迹">
          <template slot-scope="scope">
            <div>
              <p v-html="scope.row.desc"></p>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
import formatDateTimes from "@/assets/Tools/date2.js";
export default {
  data() {
    return {
      tiemlineList: [],
    };
  },
  created() {
    this.getTiemLine();
  },
  methods: {
    formatDate(val) {
      return formatDateTimes.formatDateTime3(val);
    },
    async getTiemLine() {
      const data = await this.$http.get("/partyHistory/timeline");

      if (data.code == 200) {
        this.tiemlineList = data.data;
      }
      console.log(data.data);
    },
  },
};
</script>

<style lang="less" scoped>
.table-td-headPortrait {
  width: 80px;
  height: 80px;
}
</style>
